package oopdemo.day09demo;

public class test1 {
    public static void main(String[] args){
        Student s1 = new Student("ks", "dk", 12);
        Student s2 = new Student("ld", "aak", 39);
        Student s3 = new Student("sp", "eo", 42);
        s1.show();
        delStudent("l");
        s1.show();


        
    }
    // 根据学号删除学生
    public static void delStudent(String id){
        Student[] sl = Student.getSl();
        int index =Student.getIndex();
        for (int i = 0; i < index; i++) {
            // 如果有id相同则从数组中删除学生
            if (sl[i].getId().equals(id)){
                sl[i] = null;
                return;
            }
        }
        // 不存在则提示失败
        System.out.println("此学号不存在，删除失败");
    }
}
